#!/bin/sh
if [ ! -s /etc/xrdp/rsakeys.ini ]; then
  (umask 377; touch /etc/xrdp/rsakeys.ini; /usr/bin/xrdp-keygen xrdp /etc/xrdp/rsakeys.ini)
fi

if [ ! -s /etc/xrdp/cert.pem ]; then
  (umask 377; openssl req -x509 -newkey rsa:2048 -sha256 -nodes -days 3652 \
    -keyout /etc/xrdp/key.pem \
    -out /etc/xrdp/cert.pem \
    -config /etc/xrdp/openssl.conf)
fi

exit 0
